package com.youlai.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.youlai.system.model.entity.Employ;
import com.youlai.system.model.query.EmployQuery;
import com.youlai.system.model.vo.EmployExportVO;
import com.youlai.system.model.vo.EmployVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmployMapper extends BaseMapper<Employ> {


    List<EmployVO> list(String keyword, Integer departmentId);

    boolean saveEmploy(Employ entity);
    Employ selectNewOne(String workNumber);

    boolean UpdateEmploy(Employ entity);

//    @Select("SELECT e.id as id,e.work_number, e.username,d.`name` as departmentName,e.department_id as departmentId,e.mobile FROM `employ` e LEFT JOIN dep d ON d.id = e.department_id")
    List<Employ> findAll(Integer departmentId);
    @Select("SELECT e.id as id,e.work_number, e.username,d.`name` as departmentName,e.mobile FROM `employ` e LEFT JOIN dep d ON d.id = e.department_id")
    List<Employ> findAll1();
    Employ selectByEmployId(Long id);

    List<EmployExportVO> listExportEmploy(EmployQuery queryParams);

    List<EmployExportVO> list1(String keyword, Integer departmentId);

    Integer savePhoto(String staffPhoto,Integer id);

    void insertEmployRole(Integer id,String sq);

    void insertEmployRole1(Integer id, String roleIdArray);

    @Select("SELECT id FROM employ ORDER BY id DESC LIMIT 1")
    int selectLastEmploy();

    @Select("SELECT * FROM employ WHERE work_number = #{workNumber} ")
    Employ selectByEmployWorkNumber(String workNumber);

    @Select("SELECT * from employ where id = #{id}")
    Employ getEmployById(Employ employ);
    boolean deleteEmploy(Integer id);
    @Select("SELECT * from employ where id = #{id}")
    int updatetimeofout(Employ employ);
}
